home *** CD-ROM | disk | FTP | other *** search
- Path: news.eznet.net!usenet
- From: Joe Mihalich <mihalich@eznet.net>
- Newsgroups: comp.lang.c++
- Subject: Re: Comparing Struct elements
- Date: Sat, 03 Feb 1996 16:48:30 -0500
- Organization: E-Znet Inc. Rochester N.Y. 14623 (716)-262-2485
- Message-ID: <3113D82E.7CB7@eznet.net>
- References: <4eo1va$s6k@camelot.ccs.neu.edu>
- NNTP-Posting-Host: dialin-06.eznet.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (Win95; I)
-
- saurabh bhardwaj wrote:
- > struct ClassRec {
- > char Grade[3];
- > int QH;
- > char Name[10];
- > };
- >
- > I can't seem to compare the elements of the Grade[3] with "A" or "A-" or "B+"
- > The function invariable returns 0. I've also tried using the -> operator. It
- > doesn't work either!!! Anyone know why??? I'll appreciate any help.
- >
-
- Uhh, am I missing something? If the array is declared as "char Grade[3];" then
- the array goes from 0 to 2. 3 is an invalid index! If you need an extra place
- holder than declare the array as "char Grade[4];"
-
- Hope this helps.
-
-
- --
- Joe Mihalich
- Email: mihalich@eznet.net
- Voice: 716-482-0089
-